package cn.yunhe.spring.mybatis.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.yunhe.spring.mybatis.dao.UserMapper;
import cn.yunhe.spring.mybatis.model.User;
import cn.yunhe.spring.mybatis.service.IUserService;
@Service("userService")
public class UserServiceImpl implements IUserService {
	//自动注入dao包的UserMapper类
    @Autowired
    private UserMapper userMapper;
    //添加事务注解
    @Transactional
	public User getUser() {
		// TODO Auto-generated method stub
		System.out.println("查询用户----");
		User user = new User();
		user.setId(1);
		System.out.println("用户信息："+userMapper.getUser(user));
		System.out.println("查询到了0.00.00.00.00.0");
		return userMapper.getUser(user);
	}

}
